package sw6.admin.parser;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import sw6.admin.database.DatabaseHelper;

/**
 * 
 * @author sw6b
 */
public class FirstRunInsertSettings implements ISettingsParserInjection {

	private SQLiteDatabase db;
	private String appName;
	
	public FirstRunInsertSettings(SQLiteDatabase db) {
		this.db = db;
	}
	
	@Override
	public void init(Context context, String appName) {
		this.appName = appName;
	}

	@Override
	public void handleInteger(String varName, int min, int max, int varValue) {
		DatabaseHelper.insertInteger(db, appName, varName, varValue, min, max);
	}

	@Override
	public void handleDouble(String varName, double min, double max, double varValue) {
		DatabaseHelper.insertDouble(db, appName, varName, varValue, min, max);
	}

	@Override
	public void handleBoolean(String varName, boolean varValue) {
		DatabaseHelper.insertBoolean(db, appName, varName, varValue);
	}

	@Override
	public void handleString(String varName, int min, int max, String varValue) {
		DatabaseHelper.insertString(db, appName, varName, varValue, min, max);
	}

	@Override
	public void handleObject(String varName, String type, byte[] varValue) {
		DatabaseHelper.insertObject(db, appName, varName, type, varValue);
	}

	@Override
	public void handleEnumElement(String varName, int varValue) {
		DatabaseHelper.insertEnumElement(db, appName, varName, varValue);
	}

	@Override
	public void handleEnum(String varName, int varValue) {
		DatabaseHelper.insertEnum(db, appName, varName, varValue);
	}
	
	@Override
	public void end() {
	}
	
}
